using System;
using System.Collections.Generic;
using System.Text;

namespace AntEater.ComponentModel.BuildElements
{
    /// <summary>
    /// Specifies a valid child build element of a container build element.
    /// </summary>
    [AttributeUsage(AttributeTargets.Class, AllowMultiple=true)]
    public sealed class ChildBuildElementTypeAttribute:Attribute
    {
        private Type _buildElementType;

        /// <summary>
        /// Gets the type of the build element.
        /// </summary>
        /// <value>The type of the build element.</value>
        public Type BuildElementType {
            get { return _buildElementType; }
        }

        private bool _isRequired;

        /// <summary>
        /// Gets or sets a value indicating whether this instance is required.
        /// </summary>
        /// <value>
        /// 	<c>true</c> if this instance is required; otherwise, <c>false</c>.
        /// </value>
        public bool IsRequired {
            get { return _isRequired; }
            set { _isRequired = value; }
        }

        private int _maxCount = -1;

        /// <summary>
        /// Gets or sets the max count of Child Build Elements of this Type.
        /// </summary>
        /// <value>The max count.</value>
        public int MaxCount {
            get { return _maxCount; }
            set { _maxCount = value; }
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="T:ValidChildBuildElementTypeAttribute"/> class.
        /// </summary>
        /// <param name="buildElementType">Type of the build element.</param>
        public ChildBuildElementTypeAttribute(Type buildElementType) {
            this._buildElementType = buildElementType;
        }

    }
}
